Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : Vrai-Prix8 * File : src/app/a-vendre/[uid]/analyse-cout/page.tsx9 * Module : app10 * Repository : https://git.spboucher.ai/vrai-prix11 * Created : 2026-09-0812 * Last Modified : 2026-09-0813 *14 * Author : Simon-Pierre Boucher15 * Position : Professor of Finance16 * Institution : Université du Québec en Outaouais (UQO)17 * Organization : SP Boucher18 * Website : https://spboucher.ai19 * Git : https://git.spboucher.ai20 *21 * Preferred Contact: contact@spboucher.ai22 * Development : dev@spboucher.ai23 * Support : support@spboucher.ai24 * Security/Admin : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142// /a-vendre/{uid}/analyse-cout : analyse automatisée du bâtiment d'une inscription (photos →43// profil technique → méthode du coût). Lancée sur demande seulement : elle a un coût.44import type { Metadata } from "next";45import { notFound } from "next/navigation";46import { AnalyseBatiment, type TeteAnalyse } from "@/components/avendre/batiment/AnalyseBatiment";47import { siteOrigine, titreAnnonce } from "@/components/avendre/annonce";48import { getLatest } from "@/lib/cost/ai/service";49import { getListing } from "@/lib/immoka";5051export const dynamic = "force-dynamic";5253function tete(uid: string): TeteAnalyse | null {54 const det = getListing(uid);55 if (!det) return null;56 const l = det.listing;57 const e = det.eval;58 return {59 uid: l.uid,60 titre: titreAnnonce({ address: l.address, group: det.group, city: l.city }),61 city: e?.municipalite ?? l.city,62 price: l.price,63 nImages: det.images.length,64 site: siteOrigine(l.source),65 unitId: e?.unit_id ?? null,66 evalEst: e?.est ?? null,67 modelEst: e?.model_est ?? null,68 compsEst: e?.comps_est ?? null,69 roleValue: e?.valeur_role ?? null,70 maxImages: Number(process.env.PROPERTY_ANALYSIS_MAX_IMAGES ?? 40),71 };72}7374export async function generateMetadata({ params }: { params: Promise<{ uid: string }> }): Promise<Metadata> {75 const { uid } = await params;76 const t = tete(decodeURIComponent(uid));77 if (!t) return { title: "Inscription introuvable", robots: { index: false } };78 return {79 title: `Analyse automatisée du bâtiment : ${t.titre}${t.city ? `, ${t.city}` : ""}`,80 description: "Un modèle d'intelligence artificielle décrit le bâtiment à partir des photos de l'inscription ; la méthode du coût chiffre ensuite ce profil, composante par composante. Une indication, pas un avis professionnel.",81 robots: { index: false, follow: false },82 };83}8485export default async function Page({ params }: { params: Promise<{ uid: string }> }) {86 const { uid } = await params;87 const t = tete(decodeURIComponent(uid));88 if (!t) notFound();89 return <AnalyseBatiment tete={t} initial={getLatest(t.uid)} />;90}91